package fy.erp.check;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.common.authenticate.domain.LoginUtil;
import com.seeyon.ctp.common.constants.LoginConstants;
import com.seeyon.ctp.common.constants.Constants;
import com.seeyon.ctp.common.constants.LoginResult;
import com.seeyon.ctp.login.AbstractLoginAuthentication;
import com.seeyon.ctp.login.LoginAuthenticationException;
import com.seeyon.ctp.menu.check.GroupAdminMenuCheck;
import com.seeyon.ctp.organization.manager.OrgManager;

public class LoginController extends AbstractLoginAuthentication {
	private static final Log log = LogFactory.getLog(GroupAdminMenuCheck.class);

	@Override
	public String[] authenticate(HttpServletRequest request,
			HttpServletResponse response) throws LoginAuthenticationException {
		   String username = request.getParameter(LoginConstants.USERNAME);// 用户名
		   System.out.println(username+"+请求登录");
	        String password = request.getParameter(LoginConstants.PASSWORD);// 密码
	        
	        
	        
	        
	        
	        if (username == null || password == null) {
	            return null;
	        }
	   
	        if (!username.equals("lili")) {
	            return new String[] { username, password };
	        }
	        throw new LoginAuthenticationException(LoginResult.ERROR_AD_ACCOUNT_ERROR);



	}

	
	  private OrgManager orgManager;

	  public OrgManager getOrgManager()
	  {
	    if (this.orgManager == null) {
	      this.orgManager = ((OrgManager)AppContext.getBean("orgManager"));
	    }
	    return this.orgManager;
	  }
}

